package com.scs.application.modules.dept.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.scs.application.consts.GlobalConsts;
import com.scs.application.core.mvc.controller.FlowController;
import com.scs.application.core.query.QueryContext;
import com.scs.application.core.query.QueryContextHolder;
import com.scs.application.modules.dept.entity.OprtApply;
import com.scs.application.modules.dept.service.OprtApplyService;
import com.scs.application.modules.sys.model.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 */
@RestController
@RequestMapping("/dept/oprt_apply")
public class OprtApplyController extends FlowController<OprtApplyService, OprtApply> {
    /**
     * 跟台备货选择
     */
    @GetMapping("/pageForSelect")
    public PageResult pageForSelect() {
        QueryContext queryContext = QueryContextHolder.currentContext();
        queryContext.getWrapper().eq("flow_status", GlobalConsts.FLOW_END_VALUE);
        queryContext.getWrapper().notInSql("id", " select oprt_apply_id from wm_oprt_prepare ");
        IPage pageResult = service.page(queryContext);
        return PageResult.ok("查询成功", pageResult.getRecords(), pageResult.getTotal());
    }
}
